<?php /* Smarty version Smarty-3.1.14, created on 2013-07-13 05:22:07
         compiled from ".\templates\loan.tpl" */ ?>
<?php /*%%SmartyHeaderCode:2187451e0bd7d5cc567-45080432%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '55cc8ef3506ff195399d3ea415d17a6db8eb77a2' => 
    array (
      0 => '.\\templates\\loan.tpl',
      1 => 1373683282,
      2 => 'file',
    ),
    '618a8806a72fcbb4fc6da03633741441f2646116' => 
    array (
      0 => 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\finshiv\\templates\\main.tpl',
      1 => 1373692894,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '2187451e0bd7d5cc567-45080432',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.14',
  'unifunc' => 'content_51e0bd7d6add07_20341775',
  'variables' => 
  array (
    's_activId' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_51e0bd7d6add07_20341775')) {function content_51e0bd7d6add07_20341775($_smarty_tpl) {?><?php if (!is_callable('smarty_function_html_options')) include 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\finshiv\\include\\smarty\\libs\\plugins\\function.html_options.php';
if (!is_callable('smarty_modifier_date_format')) include 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\finshiv\\include\\smarty\\libs\\plugins\\modifier.date_format.php';
if (!is_callable('smarty_function_html_select_date')) include 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\finshiv\\include\\smarty\\libs\\plugins\\function.html_select_date.php';
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head>
  <title>!! Fin Shiv !!</title>
  <script type="text/javascript" src="./js/jquery.min.js"></script>
  <link href="css/style.css" rel="stylesheet" type="text/css" />

  <style type="text/css">
  	input[type="submit"], input[type="reset"] {
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;  
    border-radius: 10px;
    }

    input[type="submit"], input[type="reset"] {
    
    
    float: right;
      margin: 2em 1em 0 1em;
      width: 10em;
      padding: .5em;
      border: 1px solid #666;
      -moz-border-radius: 10px;
      -webkit-border-radius: 10px;  
      border-radius: 10px;
      -moz-box-shadow: 0 0 .5em rgba(0, 0, 0, .8);
      -webkit-box-shadow: 0 0 .5em rgba(0, 0, 0, .8);
      box-shadow: 0 0 .5em rgba(0, 0, 0, .8);
      color: #fff;
      background: #0a0;
      font-size: 1em;
      line-height: 1em;
      font-weight: bold;
      opacity: .7;
      -webkit-appearance: none;
      -moz-transition: opacity .5s;
      -webkit-transition: opacity .5s;
      -o-transition: opacity .5s;
      transition: opacity .5s;
    }
    
    input[type="submit"]:hover,
    input[type="submit"]:active,
    input[type="reset"]:hover,
    input[type="reset"]:active {
      cursor: pointer;
      opacity: 1;
    }
    
    input[type="submit"]:active, input[type="button"]:active {
      color: #333;
      background: #eee;
      -moz-box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset;
      -webkit-box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset;
      box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset;
    }
    
    input[type="reset"] {
      background: #f33;
    }	
  </style>
  <script src="js/jquery.min.js" ></script>
  <script type="text/javascript">
    $(document).ready(function(){
      var dataString = "partyId=" + $("#partyNameSel").val();
	    $.ajax(
	    {
	      type: "GET",
	      url: "enterNewPartyAjax.php",
	      data: dataString,
	      success:function(data)
	      {
	        $('.partyData').html(data);
	      }
	    });
    });
    
  	var garanter;
    function countDays()
    {
    	var loanAmount        = $("#loanAmount").val();
    	var installmentAmount = $("#installmentAmount").val();
    	if(installmentAmount != "" && installmentAmount != 0)
      {
    	  var installmentDays   = loanAmount/installmentAmount;
    	  $("#installmentDays").val(installmentDays);
    	}
    }
    function findGuaranterId(partyObj)
    {
      var dataString = "partyId=" + $("#partyNameSel").val();
	    $.ajax(
	    {
	      type: "GET",
	      url: "enterNewPartyAjax.php",
	      data: dataString,
	      success:function(data)
	      {
	        $('.partyData').html(data);
	      }
	    });
	    
      $.ajax({
        url:'findGuaranterIdAjax.php',
        data:'fid='+partyObj.value,
        type:'post',
        dataType:'html',
        success:function(msg)
        {
          $('#loanGuaranterSel').val(msg);
        }
      });
    }
    
    function interest()
    {
    	var loanAmount = $("#loanAmount").val();
    	var monthlyInterest = $("#monthlyInterest").val();
    	var monthlyInterestRs = (loanAmount * monthlyInterest) / 100;
    	 $("#monthlyInterestRs").val(monthlyInterestRs);
    }
  </script>		

</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
    <td class="content">
    <?php if (strlen($_smarty_tpl->tpl_vars['s_activId']->value)>0){?>
      <a href="logout.php" class="link">Logout</a> |
      <a href="backup.php" style="width:15px;" class="link">&#2384;</a> |
      <a href="index.php">Home</a> |
      <a href="changePassword.php">Change Password</a> |
      <a href="loan.php">Loan</a> |
      <a href="loanList.php">Loan List</a> |
      <a href="partyList.php">Party List</a> 
    <?php }?>
    </td>
  </tr>
  <?php if (strlen($_smarty_tpl->tpl_vars['s_activId']->value)>0){?>
  <tr align="center">
    <td class="bluebg1">
      <div class="suckertreemenu">
      <br />
        <ul id="treemenu1">
        </ul>
      <br /><br /><br />
      </div>
    </td>
  </tr>
  <?php }?>
  <tr>
  <td class="content">
  
<form name="loanForm" id="loanForm" action="loan.php" method="post" enctype="multipart/form-data">
  <table cellpadding="2" cellspacing="0" border="0" align="center">
    <tr>
      <td align="right" valign="top" >
  	    <table cellpadding="2" cellspacing="0" border="1">
  	      <tr>
  	        <td colspan="2" align="center">
  	        	<h1>Loan Entry</h1>
  	        	<span style="color:red"><?php echo $_smarty_tpl->tpl_vars['msg']->value;?>
</span>
  	        </td>
  	      </tr>
  	      <tr>
            <th align="right">Party : </th>
            <td>
              <select name="partyNameSel" id="partyNameSel" onchange="findGuaranterId(this);">
                <option selected=selected value="0">-- New Party --</option>
                <?php echo smarty_function_html_options(array('values'=>$_smarty_tpl->tpl_vars['arrParty']->value['partyId'],'output'=>$_smarty_tpl->tpl_vars['arrParty']->value['partyName']),$_smarty_tpl);?>

              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Value : </th>
            <td><input type="text" name="value" placeholder="Value"></td>
          </tr>
          <tr>
            <th align="right">Loan Amount : </th>
            <td><input type="text" required=required name="loadAmount" id="loanAmount" onblur="countDays();" placeholder="Enter Loan Amount"></td>
          </tr>
          <tr>
            <th align="right">Item : </th>
            <td><input type="text" required=required name="item" id="item" ></td>
          </tr>
          <tr>
            <th align="right">Weight : </th>
            <td><input type="text" required=required name="weight" id="weight" ></td>
          </tr>
          <tr>
            <th align="right">Item Image : </th>
            <td><input type="file" name="file" id="file" ></td>
          </tr>
          <tr>
            <th align="right">Item Location : </th>
            <td><input type="text" required=required name="itemLocation" id="itemLocation" ></td>
          </tr>
          <tr>
            <th align="right">Date : </th>
            <td><?php echo smarty_function_html_select_date(array('prefix'=>'curDate','field_order'=>"DmY",'month_format'=>"%m",'start_year'=>'-5','end_year'=>'+5','time'=>smarty_modifier_date_format($_smarty_tpl->tpl_vars['today']->value,"%d-%m-%Y")),$_smarty_tpl);?>
</td>
          </tr>
          <tr>
            <th align="right">Monthly Interest % : </th>
            <td><input type="text" name="monthlyInterest" id="monthlyInterest" onblur="interest();"></td>
          </tr>
          <tr>
            <th align="right">Monthly Interest Rs : </th>
            <td><input type="text" name="monthlyInterestRs" id="monthlyInterestRs""></td>
          </tr>
        </table> 
      </td>
      <td align="left" valign="top" class="partyData"></td>
    </tr>
    <tr>
      <td colspan="2">
        <input type="reset" name="reset" id="reset" value="Reset">
        <input type="submit" name="loanBtn" id="loanBtn" value="Save">
      </td>
    </tr>
  </table>
</form> 

  </td>
  </tr>
  <tr>
    <td class="bluebg1">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/corner3.gif" width="6" height="7" /></td>
        <td></td>
        <td align="right"><img src="images/corner4.gif" width="6" height="7" /></td>
      </tr>
    </table>
    </td>
  </tr>
</table>
</body><?php }} ?>